import urllib
import urllib.request
import requests
import re
import time

def getHtml(url):
    headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'}
    response = requests.get(url, headers=headers)
    return response.text

def catchImage(html):
    pattern = re.compile(r'http://[\S]*\.mp4')
    lists = re.findall(pattern, repr(html))

    print("下载开始")
    num = 1
    for item in lists:
        urllib.request.urlretrieve(item, 'video/%s.mp4' %num)
        print("正在下载第%s个视频"%num)
        if num >= 1:
            break
        #time.sleep(2)
        num += 1
    print("下载完成")
    return

html = getHtml("http://www.budejie.com/10")
catchImage(html)